package com.xm.xmwa1706090.web.controller;

import com.xm.xm.dto.RequestDto;
import com.xm.xm.dto.ResultDto;
import com.xm.xm.dto.SearchDto;
import com.xm.xmwa1706090.service.model.QbUcenterMember;
import com.xm.xmwa1706090.service.service.QbUcenterMemberService;
import com.xm.xmwa1706090.web.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 杭州新苗网络科技有限公司
 *
 * @author meihf
 * @create 2017/7/4
 * @description
 */
@RequestMapping("/user")
@Controller
public class UserController extends BaseController{

    @Autowired
    QbUcenterMemberService qbUcenterMemberService;

    /**
     * login
     */
    @RequestMapping("/login")
    @ResponseBody
    public ResultDto login(@RequestBody SearchDto searchDto){
        searchDto.getFiled().put("ip",getIpAddr());
        return qbUcenterMemberService.login(searchDto);
    }

    /**
     * register
     */

    /**
     * 修改用户信息
     */
    @RequestMapping("/updateUserInfo")
    @ResponseBody
    public ResultDto updateUserInfo(@RequestBody RequestDto requestDto){
        requestDto.setAppUserId(getUserId());
        return qbUcenterMemberService.updateUserInfo(requestDto);
    }

    /**
     * 我的账户-车费余额
     */
    @RequestMapping("/myAccount")
    @ResponseBody
    public ResultDto myAccount(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myAccount(searchDto);
    }

    /**
     * 我的账号-至少充值金额
     */
    @RequestMapping("/limitPay")
    @ResponseBody
    public ResultDto limitPay(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.limitPay(searchDto);
    }

    /**
     * 我的账户-明细
     */
    @RequestMapping("/myMoneyDetail")
    @ResponseBody
    public ResultDto myMoneyDetail(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myMoneyDetail(searchDto);
    }

    /**
     * 我的行程
     */
    @RequestMapping("/myRidingDetail")
    @ResponseBody
    public ResultDto myRidingDetail(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myRidingDetail(searchDto);
    }

    /**
     * 申请发票-我的行程
     */
    @RequestMapping("/myInvoiceRiding")
    @ResponseBody
    public ResultDto myInvoiceRiding(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myInvoiceRiding(searchDto);
    }

    /**
     * 申请发票-信息填写
     */
    @RequestMapping("/writeInvoiceInfo")
    @ResponseBody
    public ResultDto writeInvoiceInfo(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.writeInvoiceInfo(searchDto);
    }

    /**
     * 申请发票-开票记录
     */
    @RequestMapping("/myInvoiceInfo")
    @ResponseBody
    public ResultDto myInvoiceInfo(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myInvoiceInfo(searchDto);
    }

    /**
     * 我的优惠券
     */
    @RequestMapping("/myCoupons")
    @ResponseBody
    public ResultDto myCoupons(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.myCoupons(searchDto);
    }

    /**
     * 设置-关于我们
     */
    @RequestMapping("/aboutUs")
    @ResponseBody
    public ResultDto aboutUs(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.aboutUs(searchDto);
    }

    /**
     * 设置-意见反馈
     */
    @RequestMapping("/feedBack")
    @ResponseBody
    public ResultDto feedBack(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.feedBack(searchDto);
    }
    /**
     * 客服热线
     */
    @RequestMapping("/customerPhone")
    @ResponseBody
    public ResultDto customerPhone(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return qbUcenterMemberService.customerPhone(searchDto);
    }


}
